Socket
Socket
Sign inDemoInstall

to-string-x

Package Overview
Dependencies
2
Maintainers
1
Versions
53
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    to-string-x

ES6-compliant shim for ToString.


Version published
Weekly downloads
6.6K
increased by7.84%
Maintainers
1
Install size
89.0 kB
Created
Weekly downloads
 

Readme

Source

Travis status Dependency status devDependency status npm version jsDelivr hits bettercodehub score Coverage Status

to-string-x

ES6-compliant shim for ToString.

See: 7.1.12 ToString ( argument )

module.exports(value)string

The abstract operation ToString converts argument to a value of type String.

Kind: Exported function
Returns: string - The converted value.
Throws:

  • TypeError If value is a Symbol.
ParamTypeDescription
value*The value to convert to a string.

Example

import $toString from 'to-string-x';

console.log($toString()); // 'undefined'
console.log($toString(null)); // 'null'
console.log($toString('abc')); // 'abc'
console.log($toString(true)); // 'true'
console.log($toString(Symbol('foo'))); // TypeError
console.log($toString(Symbol.iterator)); // TypeError
console.log($toString(Object(Symbol.iterator))); // TypeError
console.log($toString(Object.create(null))); // TypeError

Keywords

FAQs

Last updated on 28 Aug 2019

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc